#ifndef __SOFT_I2C_H
#define __SOFT_I2C_H

#include "stm32f4xx.h"

typedef struct Device_SoftI2C_Struct{
    GPIO_TypeDef *sclGpioPort;
    GPIO_TypeDef *sdaGpioPort;
    uint16_t sclGpioPin;
    uint16_t sdaGpioPin;
    uint32_t period;
    uint32_t sclWaitUs;
    uint32_t queryPeriod;
}Device_SoftI2C;

uint8_t     BSP_SoftI2C_Send7BitAddress(Device_SoftI2C dv, uint8_t addr, uint8_t rwBit, uint8_t inIrq);
uint8_t     BSP_SoftI2C_SendByte(Device_SoftI2C dv, uint8_t data, uint8_t inIrq);
uint8_t     BSP_SoftI2C_ReceiveByte(Device_SoftI2C dv, uint8_t inIrq, uint8_t* err);
void        BSP_SoftI2C_SendBit(Device_SoftI2C dv, BitAction bit, uint8_t inIrq);
uint8_t     BSP_SoftI2C_ReceiveBit(Device_SoftI2C dv, uint8_t inIrq);
void        BSP_SoftI2C_Start(Device_SoftI2C dv, uint8_t inIrq);
void        BSP_SoftI2C_End(Device_SoftI2C dv, uint8_t inIrq);

#endif
